package com.le.tester.javaThink.fifth.chapter14_StreamingProgramming;

import java.util.Optional;
import java.util.stream.Stream;

/**
 * 描述：optional的基本操作
 */
public class OptionalBasics {
    static void test(Optional<String> optionalS) {
        //是否存在元素
        if (optionalS.isPresent())
            System.out.println(optionalS.get());
        else
            System.out.println("Nothing inside");
    }

    public static void main(String[] args) {
        test(Stream.of("Epithets").findFirst());
        test(Stream.<String>empty().findFirst());

    }
}
